<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/wondershare/js/jquery.js"></script> 
<script src="/wondershare/js/ad.js"></script>
<script src="/wondershare/js/jquery.cvbox.min.js"></script> 

<link href="/wondershare/styles/main.css" rel="stylesheet" type="text/css" />
<link href="/wondershare/styles/general.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../images/unti.js"></script>
<title>广告<{$title}>页</title>
<script>
function  is_name_exist()
{
  $.get("http://cms.wondershare.com.br.wx/wondershare/ad.php?action=add_edit&w_type=<{$w_type}>", 
  {ad_name: $("#ad_name").val(),act: 'is_name_exist',ad_id:$("#ad_id").val()}, function(data)
  {

	 if(data >0)
	{
		 alert('广告名称已经存在库中，请重新录入！');
        $("#ad_name").focus();
		return false;
	}
 });
}

$(document).ready(function(){
  $("#ad_name").blur(function() {
     is_name_exist();
      
  });
}); 

function check_submit()
{
  if($('#ad_name').val().replace(/(^\s*)|(\s*$)/g, "")=="")
  {
      alert('广告名称不能为空！');
      $("#ad_name").focus();
      return false;
  }
  if($('#ad_name').val().replace(/(^\s*)|(\s*$)/g, "")!="")
  {
      is_name_exist();
  }
  if($('#ad_size').val().replace(/(^\s*)|(\s*$)/g, "")=="")
  {
     

      alert('广告尺寸不能为空！');
      $("#ad_size").focus();
      return false;
  }else
  {
      var patrn =  /^[0-9]{1,4}\*[0-9]{1,4}$/;
	  var ad_size = $('#ad_size').val();
	  if(!patrn.exec(ad_size))
	  {
	    alert('广告尺寸不正确！');
		$("#ad_size").focus();
		return false;
	  }
      
  }
   if($('#ad_photo').val().replace(/(^\s*)|(\s*$)/g, "")!="")
   {
		str = $('#ad_photo').val().match(/http:\/\/.+/); 
		if (str == null){
			alert('你输入的广告图片URL无效');
			$("#ad_photo").focus(); 
			return false;
		}
	}
    
	if($('#ad_url').val().replace(/(^\s*)|(\s*$)/g, "")!="")
   {
		str = $('#ad_url').val().match(/http:\/\/.+/); 
		if (str == null){
			alert('你输入的广告登陆页面URL无效');
			$("#ad_url").focus(); 
			return false;
		}
	}
	
  return true;
}
</script>
</head>

<body>
<h1>

<span class="action-span1">
<a href="http://cms.wondershare.com.br.wx/wondershare/ad.php?action=index&w_type=<{$w_type}>"><{$web_info}>广告管理</a>
</span> 
<span id="search_id" class="action-span1"> > <{$title}>广告</span>
<div style="clear:both"></div>
</h1>
<div id="tabbar-div">
      <p>
     
      </p>
    </div>
<div id="tabbody-div"  style=" width:1100px;">
      <form  name="theForm" method="post" action="/wondershare/ad.php?action=add_edit&w_type=<{$w_type}>" onsubmit="return check_submit();">
        <table align="center" width="90%" id="general-table">
          <tbody>
		  <tr>
            <td class="label">*广告名称：</td>
            <td><input type="text" size="60" style="float:left;color:;" value="<{$ad_info.ad_name}>" name="ad_name" id="ad_name"> </td>
          </tr>
		  <tr>
            <td class="label">*广告尺寸：</td>
            <td><input type="text" size="60" style="float:left;color:;" value="<{$ad_info.ad_size}>" name="ad_size" id="ad_size">&nbsp;&nbsp; <span style="color:#FF0000">如200*200这样的尺寸,宽和高不大于10000</span></td>
          </tr>
		  <tr>
            <td class="label">广告备注：</td>
            <td><input type="text" size="60" style="float:left;color:;" value="<{$ad_info.ad_remark}>" name="ad_remark" id="ad_remark">
            </td>
          </tr>
		  <tr>
            <td class="label">广告图片URL：</td>
            <td><input type="text" size="60" style="float:left;color:;" value="<{$ad_info.ad_photo}>" name="ad_photo" id="ad_photo"> 
            </td>
          </tr>
		  <tr>
            <td class="label">广告图片Alt标签：</td>
            <td><input type="text" size="60" style="float:left;color:;" value="<{$ad_info.ad_alt}>" name="ad_alt" id="ad_alt">
            </td>
          </tr>
		  <tr>
            <td class="label">广告登陆页面：</td>
            <td><input type="text" size="60" style="float:left;color:;" value="<{$ad_info.ad_url}>" name="ad_url" id="ad_url">
            </td>
          </tr>
		 
		  
		  <tr>
            <td class="label">整合类广告内容：<br /><br />(HasOffers系统广告代码)</td>
  			<td>
			  <textarea cols="60" rows="6" id="ad_content" name="ad_content"><{$ad_info.ad_content}></textarea>
              </td>
			 
          </tr>   
		  <tr>
            <td class="label">广告投放位置：</td>
  			<td>
			 <textarea cols="60" rows="6" id="delivery_content" name="delivery_content" disabled="delivery_content" wrap="on" ><{$ad_info.delivery_content}></textarea>
			 <input type="button" value="选择投放"  name="get_delivery"  style="margin-left:20px; margin-top:10px; " 
             onclick="get_ad_position_list('delivery_list');"  />
             </td>
			 
          </tr>      

        </tbody></table>

        <div  style="margin-left:380px; margin-top:20px;">
          <input type="hidden"  name="ad_id" id="ad_id" value="<{$ad_info.ad_id}>">
	      <input type="hidden"  id="w_type" name="w_type" value="<{$w_type}>" >
		  <input type="hidden" id="new_group_position" name="new_group_position"  value="<{$new_group_position}>" >
		  <input name="old_group_position" id="old_group_position"  type="hidden" value="<{$old_group_position}>"/>
		 
          <input type="submit"   class="button" value=" <{$title}> " name="sub_from">
          <input type="reset" class="button" value=" 重置 ">
        </div>
        <input type="hidden" value="<{$form_act}>" name="act" >
      </form>
    </div>
</body>
</html>